deleted_{$meta_type}_meta
Action HookDescription
Fires immediately before deleting post or comment metadata of a specific type. The dynamic portion of the hook name, `$meta_type`, refers to the meta object type (post or comment). Possible hook names include: - `delete_postmeta` - `delete_commentmeta` - `delete_termmeta` - `delete_usermeta`Hook Information
File Location |
wp-includes/meta.php
View on GitHub
|
Hook Type | Action |
Line Number | 1079 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$meta_id
|
ID of the metadata entry to delete. |
Usage Examples
Basic Usage
<?php
// Hook into deleted_{$meta_type}_meta
add_action('deleted_{$meta_type}_meta', 'my_custom_function', 10, 1);
function my_custom_function($meta_id) {
// Your custom code here
}
Source Code Context
wp-includes/meta.php:1079
- How this hook is used in WordPress core
<?php
1074
1075 // Clear the caches.
1076 wp_cache_delete( $object_id, $meta_type . '_meta' );
1077
1078 /** This action is documented in wp-includes/meta.php */
1079 do_action( "deleted_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value );
1080
1081 // Old-style action.
1082 if ( 'post' === $meta_type || 'comment' === $meta_type ) {
1083 /**
1084 * Fires immediately after deleting post or comment metadata of a specific type.
PHP Documentation
<?php
/**
* Fires immediately before deleting post or comment metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta
* object type (post or comment).
*
* Possible hook names include:
*
* - `delete_postmeta`
* - `delete_commentmeta`
* - `delete_termmeta`
* - `delete_usermeta`
*
* @since 3.4.0
*
* @param int $meta_id ID of the metadata entry to delete.
*/
Quick Info
- Hook Type: Action
- Parameters: 1
- File: wp-includes/meta.php
Related Hooks
Related hooks will be displayed here in future updates.